#include <iostream>
#include <algorithm>
#include <queue>


using namespace std;
const int N = 1e5 + 10;

struct node
{
	int id, a, t;
	bool operator<(const node& n) const
	{
		return id > n.id;
	}
}e[N];
priority_queue<node> heap;
bool cmp(node& x, node& y)
{
	return x.a < y.a;
}
int n, ret;
int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		e[i].id = i; cin >> e[i].a >> e[i].t;
	}
	sort(e + 1, e + 1 + n, cmp);
	int end = 0;
	int i = 1;
	while (i <= n || heap.size())
	{
		while (i <= n && e[i].a <= end) heap.push(e[i++]);
		if (heap.empty())
		{
			heap.push(e[i++]);
		}
		auto c = heap.top(); heap.pop();
		if (c.a >= end)
		{
			end = c.a + c.t;
		}
		else
		{
			ret = max(ret, end - c.a);
			end += c.t;
		}
	}
	
	cout << ret << endl;
	return 0;
}